package com.xfpp.javaDemo.factory.spring;

import java.util.Properties;


public class Test {

	public static void main(String[] args) throws Exception {
		//读取配置文件方式
		/*Properties p = new Properties();
		p.load(Test.class.getClassLoader().getResourceAsStream("com/xfpp/javaDemo/factory/spring/spring.properties"));
		String vehicle = p.getProperty("vehicleType");
		System.out.println(vehicle);*/
		
		BeanFactory f = new ClassPathXmlApplicationContext("com/xfpp/javaDemo/factory/spring/applicationContext.xml");
		String vehicle = f.getBean("vehicle").toString();
		
		Object o = Class.forName(vehicle).newInstance();
		Moveable m = (Moveable)o;
		m.run();
	}
	

}
